package cn.lanqiao.rabc.controller;

import cn.lanqiao.rabc.service.MenuService;
import cn.lanqiao.rabc.util.Result;
import cn.lanqiao.rabc.vo.MenuVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

//@Api(tags = "菜单管理功能")
@RequestMapping("/menu")
@Controller
public class MenuController {

    @Autowired
    MenuService menuService;

//    @GetMapping("/query")
//    public String query(Model model) {
//        List<Menu> menuList = menuService.queryMenuList();
//        model.addAttribute("menuList",menuList);
//        return "menu";
//    }

    @GetMapping("/query/{roleId}")
    public ResponseEntity query(@PathVariable int roleId) {
        List<MenuVO> menuList = menuService.queryMenuListByRoleId(roleId);
        return Result.success(menuList);
    }


}
